<?php
function foo() {
	echo "In foo()<br>\n";
}

function bar($arg = '') {
	echo "In bar(); argument was '$arg'.<br>\n";
}

// This is a wrapper function around echo
function echoit($string) {
	echo $string;
}

$func = 'foo';
$func (); // This calls foo()

$func = 'bar';
$func ( 'test' ); // This calls bar()

$func = 'echoit';
$func ( 'test' ); // This calls echoit()



class Foo
{
	function Car()
	{
		$name = 'Bar';
		$this->$name(); // This calls the Bar() method
	}

	function Bar()
	{
		echo "This is Bar";
	}
}

$foo = new Foo();
$funcname = "Car";
$foo->$funcname();   // This calls $foo->Var()
?> 